using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PrintDataGrid
{
    public partial class PrintHoSoOptions : Form
    {
        private PrintDataGrid.PrintHoSo pr;

        public PrintHoSoOptions(PrintDataGrid.PrintHoSo _pr)
        {
            InitializeComponent();
            pr = _pr;
        }

        private void PrintOtions_Load(object sender, EventArgs e)
        {
            rtb_Title.Font = pr.TitleFont;
            rtb_Body.Font = pr.ContentFont;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            pr.Show();

            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void bt_FontSelect_Click(object sender, EventArgs e)
        {
            FontDialog dlg = new FontDialog();

            dlg.Font = (sender == bt_FontSelect) ? rtb_Title.Font : rtb_Body.Font;
            dlg.ShowColor = true;
            dlg.ShowEffects = true;
           
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (sender == bt_FontSelect)
                {
                    rtb_Title.Font = dlg.Font;
                    pr.TitleFont = rtb_Title.Font;
                }
                else
                {
                    rtb_Body.Font = dlg.Font;
                    pr.ContentFont = rtb_Body.Font;
                }
            }
        }

        private void rbt_Portrait_CheckedChanged(object sender, EventArgs e)
        {
            pr.LanscapeMode = (rbt_landscape.Checked);
        }

    }
}